#define _CRT_SECURE_NO_WARNINGS 1\
#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
    double arr[12][12], sum = 0;
    int cnt = 0;
    char c;
    cin >> c;
    for (int i = 0; i < 12; i++)
    {
        for (int j = 0; j < 12; j++)
        {
            cin >> arr[i][j];
            if (i + j <= 10)
            {
                sum += arr[i][j];
                cnt++;
            }
        }
    }
    if (c == 'S')
        printf("%.1lf\n", sum);
    else
        printf("%.1lf\n", 1.0 * sum / cnt);
    return 0;
}

